package com.example.controller;

import com.example.pojo.dto.problem.ProblemSubmitAddRequest;
import com.example.pojo.judge.JudgeInfo;
import com.example.pojo.response.Result;
import com.example.pojo.sandbox.ExecuteCodeResponse;
import com.example.service.ProblemSubmitService;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "用户题目提交")
@RestController
@RequestMapping("problemSubmit")
public class ProblemSubmitController {

    @Autowired
    private ProblemSubmitService problemSubmitService;

    @Operation(summary = "题目提交")
    @PostMapping("/doProblemSubmit")
    public Result<JudgeInfo> doProblemSubmit(@RequestBody ProblemSubmitAddRequest problemSubmitAddRequest) throws JsonProcessingException {
        JudgeInfo judgeInfo = problemSubmitService.doProblemSubmit(problemSubmitAddRequest);
        return Result.ok(judgeInfo);
    }


}
